#include <cassert>
#include <string>
#include <variant>
#include <iostream>
 
void test_case1() {
    std::variant<int, std::string> v, w, x;
    v = 42; // v contains int
    int i = std::get<int>(v);
    assert(42 == i); // succeeds
    w = std::get<int>(v);
    w = std::get<0>(v); // same effect as the previous line
    w = v; // same effect as the previous line


    x = std::string("hello world");
    std::cout << " x: " << std::get<1>(x) <<  std::endl;
    // std::cout << " v: " << std::get<int>(v) <<  std::endl;
    // v = 1.90;
    // w = std::get<0>(v);
    // std::cout << "w " << w << std:endl;
}

void test_case2() {
    std::variant<int, std::string> v = "abc";
    assert(not std::holds_alternative<int>(v));
    assert(std::holds_alternative<std::string>(v));
}

int main()
{
    test_case1();
    return 0;
}